<?php
date_default_timezone_set("PRC");
$t=time();
$today=date('Y-m-d H-i-s',$t);
require 'connect.php';

//获取信息

$e_name=$_POST['name'];

$e_dept=$_POST['content'];



$sql="insert into notes (name,content,addtime) values('$e_name','$e_dept','$today')";
$result=$db->query($sql); //执行sql语句 将结果赋给$result

//判断是否添加成功
if($result)
{
    echo "<script language='javascript'type='text/javascript'>";
    echo   " alert('添加成功');";
    echo   " window.location.href='index.php';";
    echo    "</script>";
}
else
{
    echo "<script language='javascript'type='text/javascript'>";
    echo   " alert('添加失败');";
    echo   " window.location.href='index.php';";
    echo    "</script>";
}